package com.downguys.controller;

import com.downguys.domain.Passport_copy;
import com.downguys.result.ReturnResult;
import org.apache.log4j.Logger;
import org.jsondoc.core.annotation.Api;
import org.jsondoc.core.annotation.ApiMethod;
import org.jsondoc.core.annotation.ApiQueryParam;
import org.jsondoc.core.annotation.ApiVersion;
import org.jsondoc.core.pojo.ApiStage;
import org.jsondoc.core.pojo.ApiVisibility;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 账号服务
 *
 * @author xiyang.qiao
 * @date 2017/1/3 - 21:00
 */
@Api(name = "PassportController", description = "账号信息服务", group = "user", visibility = ApiVisibility.PUBLIC, stage = ApiStage.RC)
@ApiVersion(since = "1.0.0", until = "--")
@Controller
@RequestMapping(value = "/api/passport")
public class PassportController {


    public static final Logger logger = Logger.getLogger(PassportController.class);


    /**
     * 校验用户名是否存在
     *
     * @author xiyang.qiao
     * @date 2017/1/3 - 21:00
     */
    @ApiMethod(path = "/checkUsername",description = "校验账号名是否存在",produces = {MediaType.ALL_VALUE})
    @RequestMapping(value = "/checkUsername", method = RequestMethod.GET)
    @ResponseBody
    public ReturnResult checkUsername(
            @ApiQueryParam(description = "账号名",name = "userName") @RequestParam(name = "userName") String userName){

        ReturnResult returnResult = new ReturnResult();
        returnResult.setResult("exist", true);
        return returnResult;
    }


    /**
     * 通过userId获取账号信息
     *
     * @author xiyang.qiao
     * @date 2017/1/3 - 21:00
     */
    @ApiMethod(path = "/getPassport/userId",description = "通过userId获取账号信息",produces = {MediaType.ALL_VALUE})
    @RequestMapping(value = "/getPassport/userId", method = RequestMethod.GET)
    @ResponseBody
    public ReturnResult getPassportByUserId(
            @ApiQueryParam(description = "userId",name = "userId") @RequestParam(name = "userId")  int userId){

        ReturnResult returnResult = new ReturnResult();
        returnResult.setResult(new Passport_copy());
        return returnResult;
    }


    /**
     * 通过账号名获取账号信息
     *
     * @author xiyang.qiao
     * @date 2017/1/3 - 21:00
     */
    @ApiMethod(path = "/getPassport/userName",description = "通过账号名获取账号信息",produces = {MediaType.ALL_VALUE})
    @RequestMapping(value = "/getPassport/userName", method = RequestMethod.GET)
    @ResponseBody
    public ReturnResult getPassportByUserName(
            @ApiQueryParam(description = "userName",name = "userName") @RequestParam(name = "userName")  String userName){

        ReturnResult returnResult = new ReturnResult();
        returnResult.setResult(new Passport_copy());
        return returnResult;
    }

    /**
     * 通过绑定手机号获取账号信息
     *
     * @author xiyang.qiao
     * @date 2017/1/3 - 21:00
     */
    @ApiMethod(path = "/getPassport/bindMobile",description = "通过绑定手机号获取账号信息",produces = {MediaType.ALL_VALUE})
    @RequestMapping(value = "/getPassport/bindMobile", method = RequestMethod.GET)
    @ResponseBody
    public ReturnResult getPassportByBindMobile(
            @ApiQueryParam(description = "bindMobile",name = "bindMobile") @RequestParam(name = "bindMobile")  String bindMobile){

        ReturnResult returnResult = new ReturnResult();
        returnResult.setResult(new Passport_copy());
        return returnResult;
    }

}
